﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WenSkin.DLL
{
    public static class WenSkinHelper
    {
        /// <summary>
        /// string to bool
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static bool ToBool(this string value)
        {
            try
            {
                return Convert.ToBoolean(value);
            }
            catch { return false; }
        }

        /// <summary>
        /// string 解密
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static string ToAESDecrypt(this string value)
        {
            return AES.AesEnDe.AESDecrypt(value) ?? "";
        }
        
        /// <summary>
        /// string 加密
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static string ToAESEncrypt(this string value)
        {
            return AES.AesEnDe.AESEncrypt(value) ?? "";
        }
    }
}
